extends TextureButton

# 物品升级UI,可点击的那个
var item : Item:
	set(value):
		item = value
		if value.upgrades.size() > 0 && value.upgrades.size() +1 != value.level:
			texture_normal = value.texture
			%level.text = 'lv.' + str(item.level + 1)
			$Desctiption.text = value.upgrades[value.level - 1].description
		else:
			texture_normal = value.evolution.texture
			%level.text = ''
			$Desctiption.text = "EVOLUION"
			
# 绑定点击事件,触发武器升级
func _on_option_gui_input(event: InputEvent) -> void:
	if event.is_action_pressed("click") && item:
		item.upgrade_item()
		get_parent().close_option()
